home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / clover2.h.z / clover2.h
C/C++ Source or Header  |  1992-04-03  |  26KB  |  781 lines

  1. /**************************************************************************
  2.  *                                      *
  3.  *          Copyright (C) 1987, Silicon Graphics, Inc.          *
  4.  *                                      *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                      *
  11.  **************************************************************************/
  12.  
  13. /*
  14.  * clover2.h -- board defines for common to clover2 platforms (IP5,IP17)
  15.  */
  16.  
  17. #ifndef __SYS_CLOVER2_H__
  18. #define __SYS_CLOVER2_H__
  19.  
  20. #ident "$Revision: 1.5 $"
  21.  
  22. #if !LOCORE
  23. #include "sys/types.h"
  24. #endif !LOCORE
  25.  
  26. /* MP BUS id definitions */
  27. #define MPSR_BUSIDCPU    0x7        /* 0-7 are cpu slots */
  28. #define    MPSR_BUSIDFIFO    0x9
  29. #define MPSR_BUSIDGM    0xc        /* GM */
  30. #define MPSR_BUSIDIO2F    0xf        /* IO2 in slot F */
  31. #define MPSR_BUSIDIO2E    0xe        /* IO2 in slot E */
  32.  
  33. /*
  34.  * CPU type definitions for assembly code.  The C structures in "invent.h"
  35.  * cause assembler errors.
  36.  */
  37. #define R2300BOARD    1
  38. #define IP4BOARD    2
  39. #define IP5BOARD    3
  40. #define IP6BOARD    4
  41. #define IP7BOARD    5
  42. #define IP9BOARD    6
  43.  
  44. /* CPU type definitions for cputype */
  45. #define CPU_IP5        5    /* 16 Mhz multiprocessor */
  46. #define CPU_IP7        7    /* 25 Mhz multiprocessor */
  47. #define CPU_IP9        9    /* 25 Mhz singleprocessor */
  48. #define CPU_IP17    17    /* 50 Mhz R4000 uniprocessor */
  49.  
  50. /*
  51.  * Signetics 2681 DUART registers
  52.  */
  53. #if !LOCORE && !STANDALONE
  54. struct cn_chan {
  55.     unchar    cnc_mode;    u_char pad0[15];
  56.     unchar    cnc_stat;    u_char pad1[15];
  57.     unchar    cnc_cmd;    u_char pad2[15];
  58.     unchar    cnc_data;    u_char pad3[15];
  59. };
  60. #define cnc_clockselect cnc_stat
  61.  
  62. struct cn_reg {
  63.     struct    cn_chan         cn_chan_a;
  64.     unchar    cn_inport_change;    unchar pad0[15];
  65.     unchar    cn_isr;            unchar pad1[15];
  66.     unchar    cn_ctupper;        unchar pad2[15];
  67.     unchar    cn_ctlower;        unchar pad3[15];
  68.     struct    cn_chan            cn_chan_b;
  69.     unchar    cn_snipe;        unchar pad4[15];
  70.     unchar    cn_inport;        unchar pad5[15];
  71.     unchar    cn_startcount;        unchar pad6[15];
  72.     unchar    cn_stopcount;        unchar pad7[15];
  73. };
  74.  
  75. /*
  76.  * Sync Bus Controller Chip (SBCC) registers
  77.  *
  78.  * Note that the processor does 32 bit cycles to the SBCC, but only the
  79.  * the low order 16 bits of the data is significant.
  80.  */
  81. struct sbcc {
  82.     uint    level[14];        /* 0x00: CPU int levels for ids 0-D */
  83.     uint    fill0[2];
  84.     uint    status[14];        /* 0x40: Status regs for ids 0-D */
  85.     uint    fill1[2];
  86.     uint    elevel;            /* 0x80: CPU int lvl for id E (VME) */
  87.     uint    fill2[7];
  88.     uint    flevel;            /* 0xa0: CPU int lvl for id F (VME) */
  89.     uint    fill3[3];
  90.     uint    overrun;        /* 0xb0: interrupt vector overrun */
  91.     uint    fill4[3];
  92.     uint    id;            /* 0xc0: sync bus id */
  93.     uint    eintenable;        /* 0xc4: VME int enable  for id E */
  94.     uint    eintpending;        /* 0xc8: VME int pending for id E */
  95.     uint    fintenable;        /* 0xcc: VME int enable  for id F */
  96.     uint    fintpending;        /* 0xd0: VME int pending for id F */
  97.     uint    idintenable;        /* 0xd4: int enable  mask by id */
  98.     uint    idintpending;        /* 0xd8: int pending mask by id */
  99.     uint    fill9[8];
  100.     union sbcc_intxmit_u {
  101.         uint    xmit;
  102.         struct    intxmit1_s {    /* for IP5 */
  103.           uint        :16,    /* 0xfc: filler */
  104.             x_busy    :1,    /*       enable/busy bit */
  105.                 :2,
  106.             x_ot    :1,    /*       destination type */
  107.             x_destid:4,    /*       destination id */
  108.             x_status:8;    /*       interrupt status */
  109.         } xmit1_s;
  110.         struct    intxmit2_s {    /* for IP7 */
  111.           uint        :8,    /* 0xfc: filler */
  112.             x_busy    :1,    /*       enable/busy bit */
  113.                 :2,
  114.             x_ot    :1,    /*       destination type */
  115.             x_destid:4,    /*       destination id */
  116.                 :8,
  117.             x_status:8;    /*       interrupt status */
  118.         } xmit2_s;
  119.     } intxmit_u;
  120. };
  121.  
  122. #define    intxmit        intxmit_u.xmit
  123.  
  124. #define xmit1_busy    xmit1_s.x_busy
  125. #define xmit1_ot    xmit1_s.x_ot
  126. #define xmit1_destid    xmit1_s.x_destid
  127. #define xmit1_status    xmit1_s.x_status
  128.  
  129. #define intxmit1_busy    intxmit_u.xmit1_busy
  130. #define intxmit1_ot    intxmit_u.xmit1_ot;
  131. #define intxmit1_destid    intxmit_u.xmit1_destid;
  132. #define intxmit1_status    intxmit_u.xmit1_status;
  133.  
  134. #define xmit2_busy    xmit2_s.x_busy
  135. #define xmit2_ot    xmit2_s.x_ot
  136. #define xmit2_destid    xmit2_s.x_destid
  137. #define xmit2_status    xmit2_s.x_status
  138.  
  139. #define intxmit2_busy    intxmit_u.xmit2_busy
  140. #define intxmit2_ot    intxmit_u.xmit2_ot;
  141. #define intxmit2_destid    intxmit_u.xmit2_destid;
  142. #define intxmit2_status    intxmit_u.xmit2_status;
  143.  
  144. #endif !LOCORE && !STANDALONE
  145.  
  146. /* SBCC Level bits */
  147. #define    SBCC_LEVELBIT3        0x01
  148. #define    SBCC_LEVELBIT4        0x02
  149. #define    SBCC_LEVELBIT5        0x04
  150. #define    SBCC_LEVELBIT7        0x08
  151. #define    SBCC_LEVELBIT8        0x10
  152.  
  153. /* Destination Types (intxmit_ot) */
  154. #define    SINGLE    0
  155. #define    GROUP    1
  156.  
  157. /* Destination Group id masks (intxmit_destid) */
  158. #define    GROUP0    0x4
  159. #define    GROUP1    0x8
  160.  
  161. /*
  162.  * IO2 Board Addresses
  163.  */
  164. #define    SOUND_DAT_ADDR    0xb7f00000    /* SAA1099 stereo sound generator */
  165. #define    SOUND_CMD_ADDR    0xb7f00010
  166.  
  167. #define SCSI0A_ADDR    0xb7f08007    /* SCSI0 WD33C93A indirect register */
  168. #define SCSI0D_ADDR    0xb7f08107    /* SCSI0 WD33C93A data register */
  169. #define SCSI1A_ADDR    0xb7f0c007    /* SCSI1 WD33C93A indirect register */
  170. #define SCSI1D_ADDR    0xb7f0c107    /* SCSI1 WD33C93A data register */
  171.  
  172. #define    NVRAM_ADDR    0xb7f10000    /* Non-volatile RAM address */
  173. #define    RT_CLOCK_ADDR    (NVRAM_ADDR+(0x7ff<<3))
  174.                     /* This address is in the NVRAM and is
  175.                      * reserved by convention to send the
  176.                      * pattern recognition bits to. */
  177. #define    VME_RMW_ADDR    0xb7c20000    /* VME R-M-W flag */
  178. #define LOGRAM_ADDR    0xb7d00000    /* Error logging ram */
  179. #define ETMEM_ADDR    0xb7e00000    /* Start of ENET 1Mb DRAM */
  180. #define ETIO_ADDR    0xb7fc0002    /* Start of ENET IO addr */
  181. #define LANCERDP_ADDR    0xb7fc0002    /* Lance DAP reg */
  182. #define LANCERAP_ADDR    0xb7fc000a    /* Lance RAP reg */
  183. #define    LANCEHOLD_ADDR    0xb7ff8000    /* Lance Interrupt Holdoff Counter */
  184. #define    LANCERAM_ADDR    0xb7ff4000    /* Lance ethernet ring ram */
  185. #define    NVRAM_RESET    0xb7f18000    /* Reset Non-volatile RAM control */
  186. #define    IOLED_ADDR    0xb7f20000    /* IO brd LED/int status reg (7 bits) */
  187.  
  188. #define SCSI0FLUSH_ADDR 0xb7f30000    /* Flush SCSI0 DMA registers (w) */
  189. #define SCSI1FLUSH_ADDR 0xb7f34000    /* Flush SCSI1 DMA registers (w) */
  190. #define    SWITCH_ADDR    0xb7f30000    /* Switch register byte 1   (r) */
  191.  
  192. #define SCSI0CNTR_ADDR    0xb7f54000    /* SCSI 0 counter */
  193. #define SCSI1CNTR_ADDR    0xb7f58000    /* SCSI 1 counter */
  194. #define    IOINTVECTOR    0xb7f60000    /* Interrupt dest and status table */
  195. #define    INTVEC_WPAD    2        /* Word offset to next int vec */
  196. #define    INTMASK_ADDR    0xb7fe0000    /* Read for interrupt mask/pend */
  197. #define CLEARMASK_ADDR    0xb7fe0000    /* Write 1 to disable interrupt */
  198. #define SETMASK_ADDR    0xb7fe8000    /* Write 1 to enable interrupt */
  199. #define    MEMERR_ADDR    0xb7f80000    /* Memory error register */
  200. #define A24MAPA_ADDR    0xb7fa0000    /* A24 mapper address register */
  201.  
  202. #define A24MAPD_ADDR    0xb7fb0000    /* A24 mapper data */
  203. #define A24MAPW_ADDR    0xb7fa0000    /* Write to mapper address */
  204. #define A24MAPR_ADDR    0xb7fb0000    /* Pointer to mapper's entry */
  205. #define A24MAPDATA_ADDR 0xb7f28000    /* Get read data */
  206. #define    MODE_ADDR    0xb7f40000    /* Mode register */
  207. #define    MODE_BYTE0    0xb7f40000    /* BE byte addr of leftmost byte */
  208. #define MODE_BYTE1    0xb7f40001
  209. #define MODE_BYTE2    0xb7f40002
  210. #define MODE_BYTE3    0xb7f40003    /* BE byte addr of rightmost byte */
  211.  
  212.  
  213. #define    IOTIMER_ADDR    0xb7f44000    /* Free running timer register(IO3) */
  214.  
  215. #define MPBERR0_ADDR    0xb7f48000    /* Bus error or timeout address */
  216. #define MPBERR1_ADDR    0xb7f4c000    /* Write back bus error address */
  217. #define ENETPROM_ADDR    0xb7ff0000    /* Interrupt/DBE status, Enet ID prom */
  218. #define    INTRDBE_ADDR    0xb7ff0000    /* Interrupt/DBE status word */
  219. #define    ENETID_ADDR    0xb7ff0002    /* Enet ID prom, 1st byte */
  220. #define    ENETID_BPAD    8
  221.  
  222. #define ID_ADDR     0xb7fffff0    /* IO board ID */
  223. #define    ID2_ADDR    0xb7fffff3    /* IO board secondary ID */
  224.  
  225. #define ESPACE_OFFSET    0x400000    /* sub from to get equiv in E */
  226.  
  227. /*
  228.  * IO3 prom address
  229.  */
  230. #define IO3_PROM_ADDR    0xb7e00004    /* 256KB of Diagnostic Proms */
  231.  
  232. #define IO2_REV1_ID    1        /* IO2 rev1 board */
  233. #define IO2_REV2_ID    2        /* SCSI location moved up in dma mapper
  234.                        , A32 can also goes thru mapper */
  235.  
  236. #define IO3_REV1_ID    3        /* 2 SCSI controller, Enet copy can be 
  237.                        DMA-ed */
  238.  
  239. #define    IO3_REV1_ID2    0x1        /* original IO3 ID2_ADDR bit 0 is 1 */
  240. #define    IO3_REV2_ID2    0x0        /* biendian IO3 ID2_ADDR bit 0 is 0 */
  241.  
  242.  
  243. /*
  244.  * MC1 defines
  245.  */
  246. #define    MODE0_ADDR    0xb7f40000    /* Mode byte 0: VME A32 control */
  247. #define    MODE1_ADDR    0xb7f44001    /* Mode byte 1: Memory control */
  248. #define    MODE2_ADDR    0xb7f48002    /* Mode byte 2: Memory check bits */
  249. #define    MODE3_ADDR    0xb7f4c003    /* Mode byte 3: PROM/SCSI and ENET */
  250. #define    MC1LED_ADDR    0xb7f20000    /* IO brd LED/int status reg (7 bits) */
  251.  
  252. #define    MC1INTENABLE    0xb7f28000    /* Interrupt enable mask (8 bits) */
  253. #define    MC1SWITCH_ADDR    0xb7f30000    /* Switch register byte 1   (r) */
  254. #define    MC1ID_ADDR    0xb7f38000    /* Serial chasis ID PROM */
  255.  
  256. #define    MC1INTVECTOR    0xb7f60000    /* Interrupt dest and status table */
  257.  
  258. #ifdef STANDALONE
  259. /*
  260.  * STANDALONE compatibility defines so scsi.c will compile
  261.  */
  262. #define    LED_REG    LED_ADDR
  263. #define    MODE3    MODE3_ADDR
  264. #define    A24MAPA    A24MAPA_ADDR
  265. #define    A24MAPD    A24MAPD_ADDR
  266.  
  267. #endif STANDALONE
  268.  
  269. /* VME I/O space defines */
  270. #define    VME_A16NPBASE    0xb7c00000    /* a16 non-privileged address space */
  271. #define    VME_A16SBASE    0xb7c10000    /* a16 supervisor address space */
  272. #define    VME_A24NPBASE    0xb2000000    /* a24 non-privileged address space */
  273. #define    VME_A24SBASE    0xb3000000    /* a24 supervisor address space */
  274. #define    VME1_A24NPBASE    0x52000000    /* a24 non-privileged address space, 
  275.                        adapter 1  */
  276. #define    VME1_A24SBASE    0x53000000    /* a24 supervisor address space,
  277.                        adapter 1 */
  278. #define    VME1_A24NPVBASE    0xf0000000    /* a24 non-privileged virtual space, 
  279.                        adapter 1  */
  280. #define    VME1_A24SVBASE    0xf1000000    /* a24 supervisor virtual space,
  281.                        adapter 1 */
  282. #define    VME_A32NPBASE    0x20000000    /* a32 non-privileged address space */
  283. #define    VME_A32SBASE    0x30000000    /* a32 supervisor space */
  284. #define    VME_A32NPVBASE    0xd8000000    /* a32 non-privileged virtual space */
  285. #define    VME_A32SVBASE    0xe8000000    /* a32 supervisor virtual space */
  286.  
  287. #define    VME1_A32NPBASE    0x60000000    /* a32 non-privileged address space,
  288.                        adapter 1 */
  289. #define    VME1_A32SBASE    0x70000000    /* a32 supervisor space, adapter 1 */
  290. #define    VME1_A32NPVBASE    0xd0000000    /* a32 non-privileged virtual space 
  291.                        adapter 1 */
  292. #define    VME1_A32SVBASE    0xe0000000    /* a32 supervisor virtual space,
  293.                        adapter 1 */
  294.  
  295. #define    VME_A16NPSIZE    0x00010000    /* a16 non-privileged addr sp size */
  296. #define    VME_A16SSIZE    0x00010000    /* a16 supervisor addr sp size */
  297. #define    VME_A24NPSIZE    0x01000000    /* a24 non-privileged addr sp size */
  298. #define    VME_A24SSIZE    0x01000000    /* a24 supervisor addr sp size */
  299. #define    VME_A32NPSIZE    0x08000000    /* a32 non-privileged addr sp size */
  300. #define    VME_A32SSIZE    0x08000000    /* a32 supervisor addr sp size */
  301.  
  302. #if STANDALONE
  303. #define    VME_A16NPAMOD    0x29        /* a16 non-privileged addr modifier */
  304. #define    VME_A16SAMOD    0x2d        /* a16 supervisor addr modifier */
  305. #define    VME_A24NPAMOD    0x39        /* a24 non-privileged addr modifier */
  306. #define    VME_A24SAMOD    0x3d        /* a24 supervisor addr modifier */
  307. #define    VME_A32NPAMOD    0x09        /* a32 non-privileged addr modifier */
  308. #define    VME_A32SAMOD    0x0d        /* a32 supervisor addr modifier */
  309. #define    VME_A32NPBLOCK    0x0b        /* a32 non-privileged block transfer */
  310.  
  311. /* MC1 Memory address register bits */
  312. #define    MERR_ECC    0x80000000    /* 32 bit ECC == 0, 64 bit ECC == 1*/
  313. #define    MERR_PMECCM    0x40000000    /* Parity mem == 0, ECC mem == 1 */
  314. #define    MEM_PAERR    0x10000000    /* Parity error == 0 */
  315. #define    MEM_MODUMASK    0x0xf80000    /* 8 meg module number */
  316. #define    MEM_PEADDMASK    0x0ffffff0    /* Parity error word address */
  317.  
  318. #define    MEM_RW        0x00000002    /* Read == 0, Write == 1 */
  319. #define    MERR_NEXIST    0x00000001    /* Non-existant memory error == 1 */
  320. #endif    /* STANDALONE */
  321.  
  322. #ifdef LANGUAGE_C
  323. /* Interrupt vector table entry */
  324. struct mc1vector {
  325. #ifdef    MIPSEB
  326.     uint    statword;
  327.     uint    fill;
  328. #endif
  329. #ifdef    MIPSEL
  330.     uint    fill;
  331.     uint    statword;
  332. #endif
  333. };
  334.  
  335. typedef struct scuzzy {
  336.     volatile u_char    *d_addr;    /* address register */
  337.     volatile u_char    *d_data;    /* data register */
  338.     volatile u_int    *dma_lo;    /* dma lo */
  339.     volatile u_int    *dma_flush;    /* dma flush */
  340.     unsigned char d_initflags;    /* initial flags for d_flags */
  341.     unsigned char d_clock;    /* value for clock register on WD chip */
  342. } scuzzy_t;
  343. #endif /* LANGUAGE_C */
  344.  
  345.  
  346. /* Masks for interrupt status word */
  347. #define STATUS_MASK    0x00ff
  348. #define DESTID_MASK    0x0f00
  349. #define DESTID_SHIFT    8
  350. #define    INTSTAT_BERR    0x1000        /* Indicates MP bus error during DMA */
  351.  
  352. #if !LOCORE
  353. /* Interrupt mask word */
  354. union intmask {
  355.     struct {
  356.         unchar    mask;
  357.         unchar    pending;
  358.         short    unused;
  359.     }    u_fields;
  360.     uint    u_val;
  361. };
  362.  
  363. /* IO2 MPBERR1 register */
  364. union mpberr1 {
  365.     struct {
  366.         ushort    wbaddr;        /* XXX EL */
  367.         uint    :7,
  368.             valid:1,
  369.             :1,
  370.             read:1,
  371.             errtype:2,
  372.             busmaster:4;
  373.     }    u_fields;
  374.     uint    u_val;
  375. };
  376.  
  377. #define    mpbe1_wbaddr(m)        ((m) >> 16)
  378. #define    mpbe1_valid(m)        ((m) & 0x00000100)
  379. #define    mpbe1_read(m)        ((m) & 0x00000040)
  380. #define    mpbe1_errtype(m)    (((m) & 0x00000030) >> 4)
  381. #define    mpbe1_busmaster(m)    ((m) & 0x0000000f)
  382. #define    MPBERR1_CACHE    0
  383. #define    MPBERR1_DMA    1
  384. #define    MPBERR1_3WAY    2
  385. #define    MPBERR1_PIO    3
  386. #endif    /* !LOCORE */
  387.  
  388. /* MODE register definitions */
  389. /* MODE0 bits definition */
  390. #define M0_SLAVE    0x00        /* VME A32 slave address */
  391. #define M0_MASTER    0x01        /* VME A32 master address */
  392.  
  393. /* MODE1 bit definitions */
  394. #define    M1_FORCE    0x01        /* Force check bits in MODE2 */
  395. #define    M1_VMERESET    0x02        /* Assert VME Bus reset */
  396. #define    M1_LE64        0x10        /* swizzle and swap words */
  397. #define    M1_LE32        0x20        /* swizzle words */
  398.  
  399.  
  400. /* MODE2 bit definitions - these are ECC check bits for use w/ M1_FORCE */
  401.  
  402. /* MODE3 bit definitions - On-board ethernet  */
  403. #define ET_NRESET    0x01
  404. #define ET_TEST        0x02        /* pock test pin on LANCE */
  405. #define ET_PARENA    0x04        /* enable parity checking */
  406. #define ET_BADPAR    0x08        /* force bad parity */
  407. #define M3_PROM        0x40        /* IO2 only, SCSI : 0 / PROM : 1 */
  408. #define SCSI0_RESET    M3_PROM        /* SCSI0 reset */
  409. #define SCSI1_RESET    0x80        /* IO3 only, SCSI1 reset */
  410.  
  411. #ifndef STANDALONE
  412. /* use these macros while accessing MODE3 bits */
  413. extern  lock_t        hwreg_lock;
  414. #define HWREG_USELOCK()    int hwreg_spl
  415. #define HWREG_LOCK()    hwreg_spl = splock(hwreg_lock)
  416. #define HWREG_UNLOCK()    spunlock(hwreg_lock, hwreg_spl)
  417. #endif
  418.  
  419. /* A24/SCSI Mapper register definitions */
  420. #define MAPA_MASK    0x00fff000    /* mask for A24 mapper adddress */
  421. #define MAPA_SHIFT    3        /* shift for A24 mapper adddress */
  422. #define MAPD_MASK    0x0ffff000    /* mask for A24 data adddress */
  423. #define MAPA_SHIFT    3        /* shift for A24 data adddress */
  424.  
  425. /*
  426.  * The map is broken up as follows:
  427.  * IO2 rev2 DMA map allocation
  428.  *    -------------------- 0x1fff    Notes: The SCSI map locations are
  429.  *    |  64   SCSI       |         enforced by hardware.  A32 could
  430.  *    -------------------- 0x1fc0      use the rest of the map, but A24
  431.  *    |  6080 A32        |         MUST use the lower part of the map,
  432.  *    -------------------- 0x07ff     so this is enforced by software.
  433.  *    |  2048 A24        |         Only 0x7ff map entries (rather than
  434.  *    -------------------- 0x0000     0xfff) are allotted to A24 since
  435.  *                     some hardware already uses the high
  436.  *                     order addresses.
  437.  * IO3 DMA map allocation
  438.  *
  439.  *    -------------------- 0x1fff    
  440.  *    |   64  SCSI0      |    
  441.  *    -------------------- 0x1fbf    
  442.  *    |   64  SCSI1      |         
  443.  *    -------------------- 0x1f7f     
  444.  *    |   128 unused     |         
  445.  *    -------------------- 0x1eff     
  446.  *    |   256 ENET       |        
  447.  *    -------------------- 0x1dff     
  448.  *    |  5632 A32        |         
  449.  *    -------------------- 0x07ff    
  450.  *    |  2048 A24        |         
  451.  *    -------------------- 0x0000    
  452.  *
  453.  * Note: SCSI/ENET mappings are enforced by hardware.
  454.  * A24 mapping is limited to 0x800 entries since IO2/3 does not respond
  455.  * to any A24 address with the highest bit on(the CMC enet board used that addr
  456.  * range). Otherwise it would have 0x1000 entries.
  457.  * For A32, the MSB bit has to be set in order for the mapper to be activated,
  458.  * the next 3 bits must match bit 28-30 of the MODE register which are set to 0,
  459.  * the next 3 bits are don't care, then the next 13 are decoded by the mapper. 
  460.  * Therefore A32 can use any of the entries in the 8K mapper, so software has 
  461.  * to make sure that it doesn't overlap with others.
  462.  *    
  463.  */
  464. #define BASE_A24MAPREG    (1)    /* because maps can't start at zero */
  465. #define    NUM_A24MAPREG    (2048-1)/* A24 map size */
  466.  
  467. #define    BASE_A32MAPREG    (BASE_A24MAPREG+NUM_A24MAPREG)
  468.  
  469. /* for IO2 rev 1 */
  470. #define    IO2NUM1_A32MAPREG (1820) /* A32 map size for IO2 rev 1 */    
  471. #define    IO2BASE1_SCSIMAPREG (BASE_A32MAPREG+IO2NUM1_A32MAPREG)
  472.  
  473. /* for IO2 rev 2 */
  474. #define    IO2NUM2_A32MAPREG (6080) /* A32 map size for IO2 rev 2 */    
  475. #define    IO2BASE2_SCSIMAPREG (BASE_A32MAPREG+IO2NUM2_A32MAPREG)
  476.  
  477. /* for IO3 */
  478. #define    IO3NUM1_A32MAPREG (5632) /* A32 map size for IO3 */    
  479. #define IO3BASE1_ENETMAPREG (BASE_A32MAPREG+IO3NUM1_A32MAPREG)    
  480. #define NUM_ENETMAPREG    (256)    /* enet  map size */
  481. #define UNUSED_MAPREG (IO3BASE1_ENETMAPREG+NUM_ENETMAPREG)
  482. #define NUM_UNUSEDMAPREG (128)  /* unused map size */
  483. #define IO3BASE1_SCSI1MAPREG (UNUSED_MAPREG+NUM_UNUSEDMAPREG)
  484. #define NUM_SCSIMAPREG    (64)    /* SCSI map size for all IO board versions */
  485. #define IO3BASE1_SCSI0MAPREG (IO3BASE1_SCSI1MAPREG+NUM_SCSIMAPREG)
  486.  
  487. #define    A32_MAPPED    0x80000000    /* must be ORed in to the A32 DMA addr*/
  488.  
  489. /* DMALO bits */
  490. #define    DMA_READFLAG    0x00008000    /* indicates read */
  491. #define    DMA_BUSERR    0x80000000    /* indicates MP bus error occured */
  492.  
  493. #if !LOCORE
  494. union mapentry {
  495.     struct {
  496.         short    maploc;
  497.         short    page;
  498.     }    u_fields;
  499.     int    u_val;
  500. };
  501. #endif
  502.  
  503. /* IO2 VME/SCSI interrupt pending and enable masks */
  504.  
  505. #define    INTMASK_SCSI        0x01
  506. #define    INTMASK_SCSI_ENET    0x01    /* local intr, level 0 */
  507. #define    INTMASK_VME1        0x02    /* VME levels 1-7 */
  508. #define    INTMASK_VME2        0x04
  509. #define    INTMASK_VME3        0x08
  510. #define    INTMASK_VME4        0x10
  511. #define    INTMASK_VME5        0x20
  512. #define    INTMASK_VME6        0x40
  513. #define    INTMASK_VME7        0x80
  514. #define    INTMASK_VMEALL        0xfe
  515.  
  516. /* added bits for IO3, IO3 can resort to IO2 interrupt scheme or
  517. ** the new sheme which ignore level 0
  518. */
  519. #define INTMASK_SCSI0        0x100    /* SCSI0 intr, level 8 */
  520. #define INTMASK_SCSI1        0x200    /* SCSI1 intr, level 9 */
  521. #define INTMASK_IO3ENET        0x400    /* ENET intr, level 10 */
  522.  
  523. /* IO2 Interrupt vector 0 bits definitions */
  524. /* If not SCSI, ENETERR, ENETREQ then it is PROM DMA */
  525. #define SCSI0REQ_MASK    0x01        /* active low */
  526. #define SCSI1REQ_MASK    0x02        /* active low */
  527. #define ENETERR_MASK    0x02        /* active low */
  528. #define ENETREQ_MASK    0x04        /* active low */
  529. #define SCSI_ET_REQLV    0        /* scsi/if_et intr IRQ is 0 */
  530.  
  531. /* IO3 Interrupt vector 0 bits definitions, 
  532. ** if in the compatibilty mode
  533. */
  534. #define SCSI1REQ_MASK    0x02        /* SCSI1 intr on IO3, instead of ENET 
  535.                        parity err, active low */
  536.  
  537. /* defines for ENETPROM_ADDR */
  538. #define EMSK_ENETPROM        0x80        /* Lance int. Hold off */
  539. #define EI_ENETPROM        0x40        /* Lance int. w/o hold off */
  540. #define SC1I_ENETPROM        0x20
  541. #define SC0I_ENETPROM        0x10
  542. #define VBE_ENETPROM        0x08
  543. #define EBE_ENETPROM        0x04        /* Enet bus error, active lo */
  544. #define SC1BE_ENETPROM        0x02
  545. #define SC0BE_ENETPROM        0x01
  546. /*
  547.  * ID interrupt pending, enable, and overrun  masks
  548.  *
  549.  * These differ on the IP5 and the IP7; rather than use separate defines,
  550.  * we primarily use the more coherent IP5 values below, and use the
  551.  * following macro to convert from one to the other where necessary.
  552.  */
  553. #define    IP517_TO_IP79(m)    (((m << 8) & 0xff0000) | (m & 0xff))
  554. #define    IP79_TO_IP517(m)    (((m >> 8) & 0x00ff00) | (m & 0xff))
  555.  
  556. #define    INTMASK_ID0    0x0001
  557. #define    INTMASK_ID1    0x0002
  558. #define    INTMASK_ID2    0x0004
  559. #define    INTMASK_ID3    0x0008
  560. #define    INTMASK_ID4    0x0010
  561. #define    INTMASK_ID5    0x0020
  562. #define    INTMASK_ID6    0x0040
  563. #define    INTMASK_ID7    0x0080
  564. #define    INTMASK_ID8    0x0100
  565. #define    INTMASK_ID9    0x0200
  566. #define    INTMASK_IDA    0x0400
  567. #define    INTMASK_IDB    0x0800
  568. #define    INTMASK_IDC    0x1000
  569. #define    INTMASK_IDD    0x2000
  570. #define    INTMASK_IDE    0x4000
  571. #define    INTMASK_IDF    0x8000
  572. #define    INTMASK_IDALL    0xffff        /* All ID's */
  573.  
  574. #define    INTMASK_IDCPU    0x00ff        /* CPUs use IDs 0-7 */
  575. #define    INTMASK_IDIO2    0xc000        /* Either of ID's E and F */
  576. #define    INTMASK_IDFIFO    INTMASK_ID9    /* GM3 FIFO interrupt uses ID 9 */
  577. #define    INTMASK_IDGM    INTMASK_IDC    /* GM2 and GM3 use ID C */
  578. #define    INTMASK_IDOTHER    0x2d00        /* Nobody uses IDs 8, A, B, D */
  579.  
  580. #define PENDMASK    0x00ff        /* mask E and F level pending */
  581.  
  582. /*
  583.  * Read-Only bits in LED register
  584.  */
  585. #define    IOLED_INT    0x20        /* interrupt being processed by IO2 */
  586. #define IOLED_RMW    0x40        /* VME RMW flag */
  587. #define IOLED_IDDATA    0x80        /* bit-wise data from chassis PROM */
  588.  
  589. /*
  590.  * MP configuration block, one per CPU
  591.  */
  592. #define MPCONF_MAGIC    0xDEADBEEF
  593. #define MPCONF_SIZE    (32*4)        
  594.  
  595. #if !LOCORE
  596.  
  597. struct mpconf_blk {    
  598.     int    mpconf_magic;
  599.     int    mp_checksum;    /* 2-complement 32 bit checksum of 32 words */
  600.     int    phys_id;    /* CPU physical ID */
  601.     int    vir_id;        /* CPU virtual ID */    
  602.     int    errno;        /* bootstrap error */
  603.     int    (* launch)();    /* routine to start bootstrap */
  604.     int    (* rendezvous)();/* call this, when done launching*/
  605.     int    *bevutlb;    /* address of bev utlb exception handler */
  606.     int    *bevnormal;    /* address of bev normal exception handler */
  607.     int    *bevecc;    /* address of bev cache error handler (R4000 only) */
  608.     int    *bevutlb_save;    /* address of bev utlb exception handler */
  609.     int    *bevnormal_save;/* address of bev normal exception handler */
  610.     int    *bevecc_save;    /* address of bev cache error handler (R4000 only) */
  611.     int    icache_size;    /* 1st level Icache size for this CPU */
  612.     int    dcache_size;    /* 1st level Dcache size for */
  613.     int    nonbss;
  614.     int    filler[16];
  615. };
  616. #endif !LOCORE
  617.  
  618. /*
  619.  * ip9 LED setting for csu.s (realstart) 
  620.  */
  621. #define PON_IP9_MEM_BASE_CK    0x20
  622. #define PON_IP9_NO_MC2        0x21
  623.  
  624. #define PON_SWITCH_PATTERN    0x81
  625. #define SYMMON_SWITCH_PATTERN    0x82
  626. #define NODIAG_SWITCH_PATTERN    0x84    /*if set no diag other than 1st cache*/
  627. #define MPDEBUG_SWITCH_PATTERN    0x88
  628. #define PREDATOR_SWITCH_PATTERN 0X40
  629.  
  630. /* 
  631.  * Predator signal defines
  632.  */
  633. #define SP3_STROBE    0x01
  634. #define SP3_ENABLE    0x02
  635. #define SP3_DATA_OFF    0x04
  636. #define SP3_DATA    0x04
  637. #define SP3_SELECTA    0x08
  638. #define SP3_OFF        0x04    /* DATA line high turns off */
  639. #define SP3_ON        0x0
  640. #define SP3_MAXPROCS    8    /* Sp3 handles 8 processors */
  641.  
  642. /* defines for virtual mapping of VME space */
  643. #define VMEPHYS_MASK    0x0fffffff
  644. #define VME1_NPA32LO    (VME1_A32NPVBASE - K2BASE) >> BPCSHIFT
  645. #define VME1_NPA32HI    (VME1_A32NPVBASE + VME_A32SSIZE - K2BASE) >> BPCSHIFT
  646. #define VME0_NPA32HI    (VME_A32NPVBASE + VME_A32SSIZE - K2BASE) >> BPCSHIFT
  647. #define VME1_SPA32HI    (VME1_A32SVBASE + VME_A32SSIZE - K2BASE) >> BPCSHIFT
  648. #define VME0_SPA32HI    (VME_A32SVBASE + VME_A32SSIZE - K2BASE) >> BPCSHIFT
  649. #define VME1_SPA24HI    (VME1_A24SVBASE + VME_A24SSIZE - K2BASE) >> BPCSHIFT
  650.  
  651. #ifndef STANDALONE
  652. extern int vme_adapter(volatile void *addr);
  653. #endif
  654.  
  655. /*
  656.  * non-volatile ram addresses
  657.  * NOTE: everything must fit within 2kb for the Smart Watch.  Each
  658.  *     byte at a even longword boundary.
  659.  * ALSO NOTE: we need to reserve the last 3 bytes of NV RAM for valid, checksum
  660.  *           and for use in setting the real-time clock.
  661.  */
  662. #define NV_OFFSET    8
  663.  
  664. #define    NVLEN_MAX    (2045 * NV_OFFSET)  /* last 3 bytes reserved */
  665. #define    NVOFF_BASE    0
  666.  
  667. /*
  668.  * netaddr is used by network software to determine the internet
  669.  * address, it should be a string containing the appropriate
  670.  * network address in "." format
  671.  */
  672. #define    NVOFF_NETADDR    (NVOFF_BASE)
  673. #define    NVLEN_NETADDR    16
  674.  
  675. /*
  676.  * lbaud/rbaud are the initial baud rates for the duart
  677.  * (e.g. "9600")
  678.  */
  679. #define    NVOFF_LBAUD    (NVOFF_NETADDR+(NVLEN_NETADDR*NV_OFFSET))
  680. #define    NVLEN_LBAUD    5
  681.  
  682. #define    NVOFF_RBAUD    (NVOFF_LBAUD+(NVLEN_LBAUD*NV_OFFSET))
  683. #define    NVLEN_RBAUD    5
  684.  
  685. /*
  686.  * bootfile is the initial program loaded on an autoboot
  687.  * (e.g. "bfs(0)mipsboot_le")
  688.  */
  689. #define    NVOFF_BOOTFILE    (NVOFF_RBAUD+(NVLEN_RBAUD*NV_OFFSET))
  690. #define    NVLEN_BOOTFILE    50
  691.  
  692. /*
  693.  * bootmode controls autoboots/warm starts/command mode on reset
  694.  * "a" => autoboot on reset
  695.  * "w" => warm start if restart block correct, else autoboot
  696.  * anything else cause entry to command mode
  697.  */
  698. #define    NVOFF_BOOTMODE    (NVOFF_BOOTFILE+(NVLEN_BOOTFILE*NV_OFFSET))
  699. #define    NVLEN_BOOTMODE    1
  700.  
  701. /*
  702.  * console controls what consoles are enabled at power-up
  703.  * 'a' indicates "all" consoles
  704.  * 'r' indicates both local and remote uarts
  705.  * anything else indicates only local uart
  706.  */
  707. #define    NVOFF_CONSOLE    (NVOFF_BOOTMODE+(NVLEN_BOOTMODE*NV_OFFSET))
  708. #define    NVLEN_CONSOLE    1
  709.  
  710. /*
  711.  * state maintains the current validity of the tod clock and
  712.  * non-volatile ram
  713.  * Note; this byte is not used in the new lay-out, we have to keep it here
  714.  * for compatibility reason. The byte that maintains the NVRAM validity is 
  715.  * now moved to the end.
  716.  */
  717. #define    NVOFF_STUB    (NVOFF_CONSOLE+(NVLEN_CONSOLE*NV_OFFSET))
  718. #define    NVLEN_STUB    1
  719.  
  720. /*
  721.  * failcode is used by the power-on diagnostics to save a failure
  722.  * code for use by service techs
  723.  */
  724. #define    NVOFF_FAILCODE    (NVOFF_STUB+(NVLEN_STUB*NV_OFFSET))
  725. #define    NVLEN_FAILCODE    1
  726.  
  727. /*
  728.  * root identifies the disk partition that the root device will reside on.
  729.  */
  730. #define NVOFF_ROOT    (NVOFF_FAILCODE+(NVLEN_FAILCODE*NV_OFFSET))
  731. #define NVLEN_ROOT    20
  732.  
  733. /*
  734.  * keybd indicates the type of keyboard that is attached
  735.  */
  736. #define NVOFF_KEYBD    (NVOFF_ROOT+(NVLEN_ROOT*NV_OFFSET))
  737. #define NVLEN_KEYBD    10
  738.  
  739. #define NVOFF_MONITOR    (NVOFF_KEYBD+(NVLEN_KEYBD*NV_OFFSET))
  740. #define NVLEN_MONITOR    4
  741.  
  742. #define NVOFF_SYNC_ON_GREEN (NVOFF_MONITOR+(NVLEN_MONITOR*NV_OFFSET))
  743. #define NVLEN_SYNC_ON_GREEN 1
  744.  
  745. #define NVOFF_DISKLESS    (NVOFF_SYNC_ON_GREEN+(NVLEN_SYNC_ON_GREEN*NV_OFFSET))
  746. #define NVLEN_DISKLESS    1
  747.  
  748. #define PASSWD_LEN        8
  749. /*
  750.  * password_key is an encrypted key for protecting manual mode
  751.  */
  752. #define    NVOFF_PASSWD_KEY    (NVOFF_DISKLESS+(NVLEN_DISKLESS*NV_OFFSET))
  753. #define    NVLEN_PASSWD_KEY      (2*PASSWD_LEN+1)
  754.  
  755. #define NVLEN_TOTAL    (NVOFF_PASSWD_KEY+(NVLEN_PASSWD_KEY*NV_OFFSET))
  756.  
  757. #if NVLEN_TOTAL > NVLEN_MAX
  758. # include "error -- non-volatile ram overflow"
  759. #endif
  760.  
  761. /*
  762.  * the last 3 bytes of nvram are reserved for NVOFF_STATE, NVOFF_CHECKSUM
  763.  * and TOD clock
  764.  */
  765. /*
  766.  * state maintains the current validity of the tod clock and
  767.  * non-volatile ram
  768.  */
  769. #define    NVOFF_STATE    NVLEN_MAX
  770. #define    NVLEN_STATE    1
  771. /*
  772.  *  checksum is used by the power-on diagnostics to check the validity
  773.  *  of the Non-Volatile RAM contents.  let's put it at end of nvram.
  774.  */
  775. #define NVOFF_CHECKSUM        (NVOFF_STATE+(NVLEN_STATE*NV_OFFSET))
  776. #define    NVLEN_CHECKSUM        1
  777. #define NVCHECKSUM_ADDR        (NVRAM_ADDR + NVOFF_CHECKSUM)
  778. #define NVCHECKSUM_K1ADDR    PHYS_TO_K1(NVCHECKSUM_ADDR)
  779.  
  780. #endif /* __SYS_CLOVER2_H__ */
  781.